/*
 * @Author: LiuHaiL 18655112670@139.com
 * @Date: 2023-07-12 10:39:30
 * @LastEditors: LiuHaiL 18655112670@139.com
 * @LastEditTime: 2023-08-02 17:43:36
 * @FilePath: \general-admin\src\main.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { loadLang } from './lang/index'
import { registerIcons } from '/@/utils/common'
import ElementPlus from 'element-plus'
import mitt from 'mitt'
import pinia from '/@/stores/index'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import './styles/index.scss'
// modules import mark, Please do not remove.
// 如果是cdn引用MUI，无需import，使用window.MUI即可
import MUI from '@bytedance-ad/mui-vue3'
// 别忘记引入样式文件
import '@bytedance-ad/mui-vue3/dist/style.css'
import '@okee-uikit/vue3/dist/css/index.css';

import OkeeUI from '@okee-uikit/vue3'
import VueAMap, {initAMapApiLoader} from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css'

initAMapApiLoader({
    key: '5cc8d605706052940d3aca77734d26b1',
    securityJsCode: '0202946c8617dc627d0c16473b69d7b5', // 新版key需要配合安全密钥使用
    //Loca:{
    //  version: '2.0.0'
    //} // 如果需要使用loca组件库，需要加载Loca
  })

async function start() {
    const app = createApp(App)
    app.use(pinia)
    // 全局语言包加载
    await loadLang(app)
    app.use(VueAMap)
    app.use(router)
    app.use(ElementPlus)

    // 全局注册
    registerIcons(app) // icons

    app.use(MUI).use(OkeeUI).mount('#app')

    
    app.config.warnHandler = (msg, instance, trace) => {}

    app.config.globalProperties.eventBus = mitt()
}

start()
